//****************************************************************
//* Copyright (c) 2004 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   MixProcessThread.java  $$
//* $$Revision:   1.1  $$
//* $$Author:   aponte  $$
//* $$Date:   Dec 15 2008 07:08:32  $$
//*
//*****************************************************************
package ar.com.ford.it.fullEconomics.util;

import java.sql.Timestamp;
import ar.com.ford.it.fullEconomics.exception.FullEconomicsException;
import ar.com.ford.it.fullEconomics.logic.ProductionVolumesMixLogic;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas003ColorVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas012VehicleVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Teesg01Plant;
import ar.com.ford.it.fullEconomics.wslx.FullEconomicsWslxUser;
import com.ford.it.logging.ILogger;
import com.ford.it.logging.LogFactory;
import com.ford.it.persistence.PersistenceException;
import com.ford.it.persistence.Transaction;

public class MixProcessThread implements Runnable {

	private static final String THREAD_NAME = "PROCESO MIX";

	private static final String CLASS_NAME = ProductionVolumesMixLogic.class
			.getName();

	private static final ILogger log = LogFactory.getInstance().getLogger(
			CLASS_NAME);

	private Thread threadMix = null;

	// Variables a utilizar
	private Ncas012VehicleVw vehicleLine = null;

	private Timestamp fechaPrimerDiaProximoAnio = null;

	private Timestamp fechaUltimoDiaDelMes = null;

	private Timestamp fechaAntUltimoDiaDelMes = null;

	private Timestamp fechaPrimerDiaDelMes = null;

	private Ncas003ColorVw color = null;

	private Teesg01Plant teesg01Plant = null;

	private FullEconomicsWslxUser user = null;

	public ProductionVolumesMixLogic logic = new ProductionVolumesMixLogic();

	public Transaction tx = null;

	/**
	 * Constructor de la clase, el cual guarda los parametros del filtro
	 * seleccionado.
	 * 
	 * @param vehicleLine
	 * @param fecha
	 * @param color
	 * @param teesg01Plant
	 * @param user
	 * @throws PersistenceException
	 */
	public MixProcessThread(Ncas012VehicleVw vehicleLine,
			Timestamp fechaPrimerDiaProximoAnio,
			Timestamp fechaUltimoDiaDelMes, Timestamp fechaAntUltimoDiaDelMes,
			Timestamp fechaPrimerDiaDelMes, Ncas003ColorVw color,
			Teesg01Plant teesg01Plant, FullEconomicsWslxUser user)
			throws PersistenceException {
		this.color = color;
		this.fechaAntUltimoDiaDelMes = fechaAntUltimoDiaDelMes;
		this.fechaPrimerDiaDelMes = fechaPrimerDiaDelMes;
		this.fechaPrimerDiaProximoAnio = fechaPrimerDiaProximoAnio;
		this.fechaUltimoDiaDelMes = fechaUltimoDiaDelMes;
		this.teesg01Plant = teesg01Plant;
		this.user = user;
		this.vehicleLine = vehicleLine;
		// this.tx = PersistenceUtil.newTransaction();
		this.threadMix = new Thread(this);
		this.threadMix.start();
	}

	/**
	 * Metodo Run del thread
	 */
	public void run() {
		try {
			this.startMixProcess();
		} catch (FullEconomicsException e) {
			e.printStackTrace();
		}
	}

	public void startMixProcess() throws FullEconomicsException {

		String METHOD_NAME = "startMixProcess";
		log.entering(CLASS_NAME, METHOD_NAME);

//		logic.processMixProcess(vehicleLine, fechaPrimerDiaProximoAnio,
//				fechaUltimoDiaDelMes, fechaAntUltimoDiaDelMes,
//				fechaPrimerDiaDelMes, color, teesg01Plant, user);

	}

}
